package com.persicadev.khayyam;

import java.util.Random;

import com.persicadev.khayyam.R;


import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;

public class KhayyamActivity extends Activity implements OnClickListener {
	
	public static final String PREFERENCES = "Yashar & Hadi khayyam preferences";
	
	public static IPoemDb poemDb;
	public static boolean hasPersian = false;
	
	
	private RobaeiView poemView;
	
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        hasPersian = RobaeiView.hasPersian(this);
        poemDb = new PoemEngine(this);
        poemView = (RobaeiView) findViewById(R.id.poem);
        //poemView.setPoem(poemDb.getPoem(new Random().nextInt(KhayyamActivity.poemDb.totalPoems())),true);
        poemView.setPoem(poemDb.getPoem(new Random().nextInt(KhayyamActivity.poemDb.totalPoems())),false);
        poemView.setOnClickListener(this);
    }

	public void onClick(View v) {
		startActivity(new Intent(this, MainMenuActivity.class));
		overridePendingTransition(R.anim.fade_in, R.anim.fade_out);
		finish();
	}
}